feat: warn if define['process.env']
contains path
key with a value
#19517
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Added a warning if
define['process.env']
containspath: "some value"
.There are a lot of people passing
'process.env': process.env
(search). This shouldn't be done because it may expose all the env vars, which may contain access tokens.There were some PRs / issues that suggests to update the docs (#16686, #18441, #19510), but I don't think that can prevent people from doing it because the reason they did was because they didn't read the docs.
This PR adds a warning so that they can notice even without reading the docs.
The warning is output based on the following assumption:
Path
/PATH
/path
is declared on the machine and has a non-empty value: I believe this holds true in most casesprocess.env.path
is not expected to be replaced: in this case the added warning will be output even if they only havepath: "intended-value"
. But I don't think this will likely to happen and they can workaround by setting'process.env.path': 'value'
instead of'process.env': { path: 'value' }
.close #18441
close #19510